home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / icons+tools / associate_v1.5 / source / guihandler.c < prev    next >
C/C++ Source or Header  |  1996-01-11  |  16KB  |  711 lines

  1. #include <ctype.h>
  2. #include "includes.h"
  3. #include <dos/dostags.h>
  4.  
  5. #include "vars.h"
  6.  
  7. /* This file contains empty template routines that
  8.  * the IDCMP handler will call uppon. Fill out these
  9.  * routines with your code or use them as a reference
  10.  * to create your program.
  11.  */
  12.  
  13. void DoAbout( void )
  14. {
  15.   rtEZRequestTags("Associate, A nice WB Util By Dominic Clifton - Hydra/LSD\n"
  16.                   "1995 Deluxe Software Ltd.\n\n"
  17.                   "This program is FreeWare! so spread and use it\n"
  18.                   "but do NOT modify it in ANY way at all.\n"
  19.                   "\n"
  20.                   "Permission is GRANTED to use this in\n"
  21.                   "any commercial package, it can also be\n"
  22.                   "included on coverdisks and such like\n",
  23.                   "Cool!",
  24.                   NULL,NULL,RTGS_Flags, GSREQF_CENTERTEXT,
  25.                   RT_Window,AssociateWnd,TAG_END);
  26. }
  27.  
  28. BOOL SelectFile(char *Filename,char *title,char *wildcards)
  29. {
  30.   char *dirname;
  31.   short chars;
  32.   BOOL retval=FALSE;
  33.   strcpy(tmpstr,FilePart(Filename));
  34.  
  35.   chars=(short)((int)PathPart(Filename)-(int)Filename);
  36.   if (dirname=AllocMem(chars+1,MEMF_PUBLIC|MEMF_CLEAR))
  37.   {
  38.     strncpy(dirname,Filename,chars);
  39.     rtChangeReqAttr(filereq,RTFI_MatchPat,wildcards,
  40.                             RTFI_Dir, dirname,
  41.                             TAG_DONE);
  42.  
  43.     if (rtFileRequest (filereq, tmpstr, title,RTFI_Flags,FREQF_PATGAD,TAG_END))
  44.     {
  45.       strcpy(Filename,filereq->Dir);
  46.       AddPart(Filename,tmpstr,MAX_TEMP_STR_LEN);
  47.       retval=TRUE;
  48.     }
  49.     FreeMem(dirname,chars+1);
  50.   }
  51.   return(retval);
  52. }
  53.  
  54. struct TypeNode *FindTypeNode( void )
  55. {
  56.   struct TypeNode *node=NULL;
  57.   LONG num;
  58.  
  59. #ifdef KS30
  60.   if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_TypeList],AssociateWnd,NULL,
  61.                     GTLV_Selected,&num,
  62.                     TAG_DONE))
  63.   {
  64. #endif
  65.  
  66. #ifdef KS20
  67.   num=LastTypeClicked;
  68. #endif
  69.     if (num>=0)
  70.     {
  71.       node=(struct TypeNode *) GetNode(typelist,num);
  72.     }
  73. #ifdef KS30
  74.   }
  75. #endif
  76.   return(node);
  77. }
  78.  
  79. void UpdateLists( void )
  80. {
  81.   GT_SetGadgetAttrs(AssociateGadgets[GD_TypeList], AssociateWnd, NULL,
  82.                     GTLV_Labels, (ULONG)typelist,
  83.                     TAG_END);
  84.  
  85.   if (temptnode=FindTypeNode())
  86.   {
  87. #ifdef KS20
  88.     LastNamePClicked=-1;
  89.     LastFilePClicked=-1;
  90. #endif
  91.     GT_SetGadgetAttrs(AssociateGadgets[GD_NamePList], AssociateWnd, NULL,
  92.                       GTLV_Labels, (ULONG)temptnode->nameplist,
  93.                       TAG_END);
  94.     GT_SetGadgetAttrs(AssociateGadgets[GD_FilePList], AssociateWnd, NULL,
  95.                       GTLV_Labels, (ULONG)temptnode->fileplist,
  96.                       TAG_END);
  97.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconStr], AssociateWnd, NULL,
  98.                       GA_Disabled, FALSE,
  99.                       GTST_String, temptnode->IconName,
  100.                       TAG_END);
  101.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconRun],AssociateWnd,NULL,
  102.                       GA_Disabled, FALSE,
  103.                       GTCB_Checked,temptnode->RunInfo,
  104.                       TAG_DONE);
  105.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconInfo],AssociateWnd,NULL,
  106.                       GA_Disabled, FALSE,
  107.                       TAG_DONE);
  108.   }
  109.   else // blank the lists..
  110.   {
  111.     GT_SetGadgetAttrs(AssociateGadgets[GD_NamePList], AssociateWnd, NULL,
  112.                       GTLV_Labels, NULL,
  113.                       TAG_END);
  114.     GT_SetGadgetAttrs(AssociateGadgets[GD_FilePList], AssociateWnd, NULL,
  115.                       GTLV_Labels, NULL,
  116.                       TAG_END);
  117.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconStr], AssociateWnd, NULL,
  118.                       GA_Disabled, TRUE,
  119.                       GTST_String, NULL,
  120.                       TAG_END);
  121.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconRun],AssociateWnd,NULL,
  122.                       GA_Disabled, TRUE,
  123.                       GTCB_Checked,FALSE,
  124.                       TAG_DONE);
  125.     GT_SetGadgetAttrs(AssociateGadgets[GD_IconInfo],AssociateWnd,NULL,
  126.                       GA_Disabled, TRUE,
  127.                       TAG_DONE);
  128.   }
  129. }
  130.  
  131. int TypeListClicked( void )
  132. {
  133.   /* routine when gadget "File Type" is clicked. */
  134.  
  135. #ifdef KS20
  136.   LastTypeClicked=AssociateMsg.Code;
  137. #endif
  138.   UpdateLists();
  139.   return(1);
  140. }
  141.  
  142. int NamePListClicked( void )
  143. {
  144.   /* routine when gadget "Name Patterns" is clicked. */
  145. #ifdef KS20
  146.   LastNamePClicked=AssociateMsg.Code;
  147. #endif
  148.   return(1);
  149. }
  150.  
  151. int FilePListClicked( void )
  152. {
  153.   /* routine when gadget "File Patterns" is clicked. */
  154. #ifdef KS20
  155.   LastFilePClicked=AssociateMsg.Code;
  156. #endif
  157.   return(1);
  158. }
  159.  
  160. int IconPickClicked( void )
  161. {
  162.   /* routine when gadget "" is clicked. */
  163.  
  164.   if (temptnode=FindTypeNode())
  165.   {
  166.     if (SelectFile(temptnode->IconName,"Select an Icon!","#?.info"))
  167.     {
  168.       GT_SetGadgetAttrs(AssociateGadgets[GD_IconStr], AssociateWnd, NULL,
  169.                         GTST_String, temptnode->IconName,
  170.                         TAG_END);
  171.     }
  172.   }
  173.   return(1);
  174. }
  175.  
  176. int IconStrClicked( void )
  177. {
  178.   /* routine when gadget "Icon Filename" is clicked. */
  179.  
  180.   if (temptnode=FindTypeNode())
  181.   {
  182.     strcpy(temptnode->IconName,GetString(AssociateGadgets[GD_IconStr]));
  183.   }
  184.   return(1);
  185. }
  186.  
  187. void addterm(char *s)
  188. {
  189.   if (s[strlen(s)-1]!=':' && s[strlen(s)-1]!='/') strcat(s,"/");
  190. }
  191.  
  192. char *getparent(char *s)
  193. {
  194.   int l;
  195.   char *outname;
  196.  
  197.   if (outname=strdup(s))
  198.   {
  199.     addterm(outname);
  200.     l=strlen(outname);
  201.  
  202.     if (outname[l-1]=='/')
  203.     {
  204.       l--;
  205.       while (outname[l-1]!='/' && outname[l-1]!=':') l--;
  206.       outname[l]='\0';
  207.     }
  208.   }
  209.   return(outname);
  210. }
  211.  
  212. char *upcase(char *str)
  213. {
  214.   // converts str into uppercase and returns a pointer to a new
  215.   // string.
  216.   // returns NULL if it fails.
  217.  
  218.   char *outstr;
  219.   short loop;
  220.  
  221.   if (outstr=strdup(str))
  222.   {
  223.     for (loop=0;str[loop];loop++) outstr[loop]=toupper(str[loop]);
  224.   }
  225.   return(outstr);
  226. }
  227.  
  228. short position(char *substr,char *str)
  229. {
  230.   // returns an character offset of a substring in a string
  231.   // this version is CASE SENSITIVE
  232.   // returns -1 if substring not found in the string
  233.  
  234.   char *whstr;
  235.   return((short)((whstr=strstr(str,substr)) ? (short)((LONG)whstr-(LONG)str) : -1));
  236. }
  237.  
  238. short iposition(char *substr,char *str)
  239. {
  240.   // returns an character offset of a substring in a string
  241.   // this version is CASE INSENSITIVE
  242.   // returns -1 if substring not found in the string
  243.   //      or -2 if memory allocation error
  244.  
  245.   short where=-2;
  246.   char *isubstr,*istr;
  247.  
  248.   if (isubstr=upcase(substr))
  249.   {
  250.     if (istr=upcase(str))
  251.     {
  252.       where=position(isubstr,istr);
  253.       free(isubstr);
  254.     }
  255.     free(istr);
  256.   }
  257.   return(where);
  258. }
  259.  
  260. void removeinfo( char *str)
  261. {
  262.   short slen;
  263.  
  264.   // i know this looks tacky but it's fast and small... :-)
  265.  
  266.   slen=strlen(str)-1;
  267.   if (toupper(str[slen])=='O' &&
  268.       toupper(str[slen-1])=='F' &&
  269.       toupper(str[slen-2])=='N' &&
  270.       toupper(str[slen-3])=='I' &&
  271.       toupper(str[slen-4])=='.')
  272.   {
  273.     str[slen-4]=0;
  274.   }
  275.  
  276.  
  277.   if (stricmp(str+(strlen(str)-5),".info")==0) puts("moocow!");
  278. }
  279.  
  280. void DoInfo( char *fname)
  281. {
  282.   BPTR FL;
  283.   char *drawername;
  284.   char *filename;
  285.   char *wholestr;
  286.  
  287.   if (WorkbenchBase->lib_Version>=39)
  288.   {
  289.     if (wholestr=strdup(fname))
  290.     {
  291.       if (wholestr[0])
  292.       {
  293.         removeinfo(wholestr);
  294.         drawername=getparent(wholestr);
  295.         filename=FilePart(wholestr);
  296.         if (FL=Lock(drawername,ACCESS_READ))
  297.         {
  298.           WBInfo(FL,filename,Scr);
  299.           UnLock(FL);
  300.         }
  301.         free(drawername);
  302.       }
  303.       free(wholestr);
  304.     }
  305.   }
  306.   else rtEZRequest("Sorry, You Need WB 3.0+ to access Icon Info","Damn!",NULL,NULL);
  307. }
  308.  
  309. int IconInfoClicked( void )
  310. {
  311.   /* routine when gadget "Icon Info" is clicked. */
  312.   if (temptnode=FindTypeNode())
  313.   {
  314.     if (temptnode->IconName)
  315.     {
  316.       DoInfo(temptnode->IconName);
  317.     }
  318.   }
  319.   return(1);
  320. }
  321. int IconRunClicked( void )
  322. {
  323.   /* routine when gadget "Run Info When activated" is clicked. */
  324.  
  325.   if (temptnode=FindTypeNode())
  326.   {
  327.     GT_GetGadgetAttrs(AssociateGadgets[GD_IconRun],AssociateWnd,NULL,
  328.                       GTCB_Checked,&temptnode->RunInfo,
  329.                       TAG_DONE);
  330.   }
  331.   return(1);
  332. }
  333.  
  334. int TypeAddClicked( void )
  335. {
  336.   /* routine when gadget "Add" is clicked. */
  337.  
  338.   char *tmpstr;
  339.  
  340.   if (tmpstr=AllocMem(256,MEMF_PUBLIC|MEMF_CLEAR)) //MEMF_CLEAR to nullify string..
  341.   {
  342.     if (rtGetString(tmpstr,255, "Enter File Type Name", NULL,RT_Window,AssociateWnd, TAG_END))
  343.     {
  344.       NewTypeNode(typelist,tmpstr);
  345.       UpdateLists();
  346.     }
  347.     FreeMem(tmpstr,256);
  348.   }
  349.   return(1);
  350. }
  351.  
  352. int TypeDeleteClicked( void )
  353. {
  354.   /* routine when gadget "Delete" is clicked. */
  355.   if (temptnode=FindTypeNode())
  356.   {
  357.     if (rtEZRequest("Sure ?","Yeah!|No Way!",NULL,NULL))
  358.     {
  359.       FreeTypeNode(temptnode);
  360.       Remove((struct Node*)temptnode);
  361.       FreeMem(temptnode,sizeof(struct TypeNode));
  362.       UpdateLists();
  363.     }
  364.   }
  365.   return(1);
  366. }
  367.  
  368. int NamePAddClicked( void )
  369. {
  370.   /* routine when gadget "Add" is clicked. */
  371.   char *tmpstr;
  372.   if (temptnode=FindTypeNode())
  373.   {
  374.     if (tmpstr=AllocMem(256,MEMF_PUBLIC|MEMF_CLEAR)) //MEMF_CLEAR to nullify string..
  375.     {
  376.       if (rtGetString(tmpstr,255, "Enter Name Match String", NULL,RT_Window,AssociateWnd, TAG_END))
  377.       {
  378.         NewNameNode(temptnode->nameplist,tmpstr);
  379.         GT_SetGadgetAttrs(AssociateGadgets[GD_NamePList], AssociateWnd, NULL,
  380.                           GTLV_Labels, (ULONG)temptnode->nameplist,
  381.                           TAG_END);
  382.       }
  383.     }
  384.     FreeMem(tmpstr,256);
  385.   }
  386.   return(1);
  387. }
  388.  
  389. int NamePDeleteClicked( void )
  390. {
  391.   /* routine when gadget "Delete" is clicked. */
  392.  
  393.   LONG num;
  394.   struct Node *node;
  395.  
  396.   if (temptnode=FindTypeNode())
  397.   {
  398. #ifdef KS30
  399.     if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_NamePList],AssociateWnd,NULL,
  400.                     GTLV_Selected,&num,
  401.                     TAG_DONE))
  402.     {
  403. #endif
  404.  
  405. #ifdef KS20
  406.     num=LastNamePClicked;
  407. #endif
  408.  
  409.       if (num>=0)
  410.       {
  411.         node=GetNode(temptnode->nameplist,num);
  412.         FreeNameNode(node);
  413.         Remove(node);
  414.         FreeMem(node,sizeof(struct Node));
  415.         UpdateLists();
  416.       }
  417. #ifdef KS30
  418.     }
  419. #endif
  420.   }
  421.  
  422.   return(1);
  423. }
  424.  
  425. int FilePAddClicked( void )
  426. {
  427.   /* routine when gadget "Add" is clicked. */
  428.  
  429.   char *tmpstr;
  430.  
  431.   if (temptnode=FindTypeNode())
  432.   {
  433.     if (tmpstr=AllocMem(256,MEMF_PUBLIC|MEMF_CLEAR)) //MEMF_CLEAR to nullify string..
  434.     {
  435.       if (rtGetString(tmpstr,255, "Enter File Match String", NULL,RT_Window,AssociateWnd, TAG_END))
  436.       {
  437.         NewNameNode(temptnode->fileplist,tmpstr);
  438.         GT_SetGadgetAttrs(AssociateGadgets[GD_FilePList], AssociateWnd, NULL,
  439.                           GTLV_Labels, (ULONG)temptnode->fileplist,
  440.                           TAG_END);
  441.       }
  442.     }
  443.     FreeMem(tmpstr,256);
  444.   }
  445.   return(1);
  446. }
  447.  
  448. int FilePDeleteClicked( void )
  449. {
  450.   /* routine when gadget "Delete" is clicked. */
  451.   LONG num;
  452.   struct Node *node;
  453.  
  454.   if (temptnode=FindTypeNode())
  455.   {
  456. #ifdef KS30
  457.  
  458.     if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_FilePList],AssociateWnd,NULL,
  459.                     GTLV_Selected,&num,
  460.                     TAG_DONE))
  461.     {
  462. #endif
  463. #ifdef KS20
  464.     num=LastFilePClicked;
  465. #endif
  466.       if (num>=0)
  467.       {
  468.         node=GetNode(temptnode->fileplist,num);
  469.         FreeNameNode(node);
  470.         Remove(node);
  471.         FreeMem(node,sizeof(struct Node));
  472.         UpdateLists();
  473.       }
  474. #ifdef KS30
  475.     }
  476. #endif
  477.   }
  478.   return(1);
  479. }
  480.  
  481. int SaveClicked( void )
  482. {
  483.   /* routine when gadget "Save" is clicked. */
  484.   SavePrefs();
  485.   return(0);
  486. }
  487.  
  488. int HelpClicked( void )
  489. {
  490.   /* routine when gadget "Help" is clicked. */
  491.   static ULONG sysargs[] =
  492.   {
  493.     SYS_Input,NULL,
  494.     SYS_Output,NULL,
  495.     SYS_Asynch,FALSE,
  496.     SYS_UserShell,TRUE,
  497.     NP_Priority,0L,
  498.     TAG_DONE
  499.   };
  500.  
  501.   if (SystemTagList("AmigaGuide Associate.Guide",(struct TagItem *)sysargs)!=0)
  502.   {
  503.     if (SystemTagList("AmigaGuide progdir:Associate.Guide",(struct TagItem *)sysargs)!=0)
  504.     {
  505.       rtEZRequest("Sorry, I Can't find AmigaGuide\n"
  506.                   "and/or the Assoiciate.Guide file",okstr,NULL,(struct TagItem *)&reqtags,NULL);
  507.     }
  508.   }
  509.   return(1);
  510. }
  511.  
  512. int OKClicked( void )
  513. {
  514.   /* routine when gadget "OK" is clicked. */
  515.   return(0);
  516. }
  517.  
  518. int TypeEditClicked( void )
  519. {
  520.   /* routine when gadget "Edit" is clicked. */
  521.   LONG num;
  522.   struct Node *node;
  523. #ifdef KS30
  524.  
  525.   if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_TypeList],AssociateWnd,NULL,
  526.                   GTLV_Selected,&num,
  527.                   TAG_DONE))
  528.   {
  529. #endif
  530. #ifdef KS20
  531.   num=LastTypeClicked;
  532. #endif
  533.     if (num>=0)
  534.     {
  535.       node=GetNode(typelist,num);
  536.       if (rtGetString(node->ln_Name,255, "Edit Filetype Name", NULL,RT_Window,AssociateWnd, TAG_END))
  537.       {
  538.         GT_SetGadgetAttrs(AssociateGadgets[GD_TypeList], AssociateWnd, NULL,
  539.                           GTLV_Labels, (ULONG)typelist,
  540.                           TAG_END);
  541.       }
  542. #ifdef KS30
  543.     }
  544. #endif
  545.   }
  546.   return(1);
  547. }
  548.  
  549. int NamePEditClicked( void )
  550. {
  551.   /* routine when gadget "Edit" is clicked. */
  552.   LONG num;
  553.   struct Node *node;
  554.  
  555.   if (temptnode=FindTypeNode())
  556.   {
  557. #ifdef KS30
  558.     if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_NamePList],AssociateWnd,NULL,
  559.                     GTLV_Selected,&num,
  560.                     TAG_DONE))
  561.     {
  562. #endif
  563. #ifdef KS20
  564.     num=LastNamePClicked;
  565. #endif
  566.       if (num>=0)
  567.       {
  568.         node=GetNode(temptnode->nameplist,num);
  569.         if (rtGetString(node->ln_Name,255, "Edit Match String", NULL,RT_Window,AssociateWnd, TAG_END))
  570.         {
  571.           GT_SetGadgetAttrs(AssociateGadgets[GD_NamePList], AssociateWnd, NULL,
  572.                             GTLV_Labels, (ULONG)temptnode->nameplist,
  573.                             TAG_END);
  574.         }
  575.       }
  576. #ifdef KS30
  577.     }
  578. #endif
  579.   }
  580.   return(1);
  581. }
  582.  
  583. int FilePEditClicked( void )
  584. {
  585.   /* routine when gadget "Edit" is clicked. */
  586.   LONG num;
  587.   struct Node *node;
  588.  
  589.   if (temptnode=FindTypeNode())
  590.   {
  591. #ifdef KS30
  592.     if (1==GT_GetGadgetAttrs(AssociateGadgets[GD_FilePList],AssociateWnd,NULL,
  593.                     GTLV_Selected,&num,
  594.                     TAG_DONE))
  595.     {
  596. #endif
  597. #ifdef KS20
  598.       num=LastFilePClicked;
  599. #endif
  600.       if (num>=0)
  601.       {
  602.         node=GetNode(temptnode->fileplist,num);
  603.         if (rtGetString(node->ln_Name,255, "Edit Match String", NULL,RT_Window,AssociateWnd, TAG_END))
  604.         {
  605.           GT_SetGadgetAttrs(AssociateGadgets[GD_FilePList], AssociateWnd, NULL,
  606.                             GTLV_Labels, (ULONG)temptnode->fileplist,
  607.                             TAG_END);
  608.         }
  609.       }
  610. #ifdef KS30
  611.     }
  612. #endif
  613.   }
  614.   return(1);
  615. }
  616.  
  617. int AssociateItem0( void )
  618. {
  619.   /* routine when (sub)item "About" is selected. */
  620.   DoAbout();
  621.   return(1);
  622. }
  623.  
  624. int AssociateItem1( void )
  625. {
  626.   /* routine when (sub)item "Quit!" is selected. */
  627.   done=TRUE;
  628.   return(0);
  629. }
  630.  
  631. int AssociateCloseWindow( void )
  632. {
  633.   /* routine for "IDCMP_CLOSEWINDOW". */
  634.   return(0);
  635. }
  636.  
  637.  
  638. int PickTypeClicked( void )
  639. {
  640.   /* routine when gadget "" is clicked. */
  641. #ifdef KS20
  642.   LastPickClicked=PickMsg.Code;
  643. #endif
  644.   if (DoubleClick(LastSec,LastMic,PickMsg.Seconds,PickMsg.Micros))
  645.   {
  646.     return(PickOkClicked());
  647.   }
  648.   else
  649.   {
  650.     LastSec=PickMsg.Seconds;
  651.     LastMic=PickMsg.Micros;
  652.     return(1);
  653.   }
  654. }
  655.  
  656. int PickOkClicked( void )
  657. {
  658.   /* routine when gadget "Ok!" is clicked. */
  659.  
  660.   LONG num;
  661.   int retval=1;
  662. #ifdef KS30
  663.   if (1==GT_GetGadgetAttrs(PickGadgets[GD_PickType],PickWnd,NULL,
  664.                            GTLV_Selected,&num,
  665.                            TAG_DONE))
  666.   {
  667. #endif
  668. #ifdef KS20
  669.       num=LastPickClicked;
  670. #endif
  671.     if (num>=0)
  672.     {
  673.       temptnode=(struct TypeNode *) GetNode(typelist,num);
  674.       retval=0;
  675.     }
  676. #ifdef KS30
  677.   }
  678. #endif
  679.   return(retval);
  680. }
  681.  
  682. int PickCancelClicked( void )
  683. {
  684.   /* routine when gadget "Cancel" is clicked. */
  685.   temptnode=NULL;
  686.   return(0);
  687. }
  688.  
  689. int PickCloseWindow( void )
  690. {
  691.   /* routine for "IDCMP_CLOSEWINDOW". */
  692.   // hmm.  does this funtion get called when there is no close gadget ?
  693.   return(0);
  694. }
  695.  
  696. int PickVanillaKey( void )
  697. {
  698.   /* routine for "IDCMP_VANILLAKEY". */
  699.   switch (PickMsg.Code)
  700.   {
  701.     case 13:
  702.       return(PickOkClicked());
  703.       break;
  704.     case 27:
  705.       temptnode=NULL;
  706.       return(0);
  707.       break;
  708.   }
  709.   return(1);
  710. }
  711.